<template>
  <div class="loading-overlay" v-show="isLoading">
    <div class="overlay-content">
      <div class="spinner"></div>
      <p>{{ loadingText }}</p>
    </div>
  </div>
</template>

<script lang="ts" setup>

defineProps({
  isLoading: {
    type: Boolean,
    default: false
  },
  loadingText: {
    type: String,
    default: '拼命加载中...'
  }
})
</script>

<style scoped>
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.overlay-content {
  text-align: center;
  color: #00c2ff;

  p {
    margin-top: 20px;
  }
}

.spinner {
  border: 4px solid rgba(21, 72, 77, 0.57);
  border-radius: 50%;
  border-top: 4px solid #00e6ff;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
</style>
